
var PerformenceS = function () {}
PerformenceS.prototype.calculate = function (salary) {
    return salary * 4
}
var PerformenceA = function () {}
PerformenceA.prototype.calculate = function (salary) {
    return salary * 3
}
var PerformenceB = function () {}
PerformenceB.prototype.calculate = function (salary) {
    return salary * 2
}

var Bonus = function () {
    this.salary = null;
    this.strategy = null
}

Bonus.prototype.setSalary = function (salary) {
    this.salary = salary
}
Bonus.prototype.setStrategy = function (strategy) {
    this.strategy = strategy
}
Bonus.prototype.getBonus = function () {
    return this.strategy.calculate(this.salary)
}

var a = new Bonus()
a.setSalary(100)
// a.setStrategy(new PerformenceS())
// a.setStrategy(new PerformenceA())
a.setStrategy(new PerformenceB())
console.log(a.getBonus());